//
//  ZZDeviceList.m
//  ZZBlue
//
//  Created by stonesMonkey on 2017/9/19.
//  Copyright © 2017年 stonesMonkey. All rights reserved.
//

#import "ZZDeviceList.h"
#import "ZZDeviceModel.h"
@implementation ZZDeviceList

-(void)encodeWithCoder:(NSCoder *)aCoder
{
    
    [aCoder encodeObject:self.listName forKey:@"listName"];
    [aCoder encodeObject:self.deviceList forKey:@"deviceList"];
      [aCoder encodeBool:self.isFindNewDevice forKey:@"isFindNewDevice"];
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super init]) {
        
        self.listName = [aDecoder decodeObjectForKey:@"listName"];
        self.deviceList = [aDecoder decodeObjectForKey:@"deviceList"];
        self.isFindNewDevice = [aDecoder decodeBoolForKey:@"isFindNewDevice"];
        
        if (self.isFindNewDevice) {
            
            [self.deviceList removeAllObjects];
        }
    }
    return self;
}

- (NSMutableArray<ZZDeviceModel *> *)deviceList {
    
    if (!_deviceList) {
        
        _deviceList = [NSMutableArray array];
    }
    return _deviceList;
}

@end
